package com.zfei.gfb.query;

import com.zfei.gfb.bean.Const;
import com.zfei.gfb.bean.Page;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author fgh
 */
public class GfbUserQuery extends Page {

    // 用户名
    @ApiModelProperty(value = "用户名", required = false)
    private String name;
    // 类型 1: 镇，2：村
    @ApiModelProperty(value = "级别，1: 镇级管理员，2：村级管理员", required = false)
    private Integer type;

    public void setName(String value) {
        this.name = value;
    }

    public String getName() {
        return this.name;
    }

    public void setType(Integer value) {
        this.type = value;
    }

    public Integer getType() {
        return this.type;
    }

    public Page check(){
        if(type != null && (type != Const.GFB_TOWN_MANAGER && type != Const.GFB_VILLAGE_MANAGER)){
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        return this;
    }
}

